<template>
  <ul class="catagtory">
    <li
      @click="changeIndex(item.id)"
      :class='{select:currentCatagtory===item.id}' v-for="item in catagtory" :key="item.id"
    >
      {{item.name}}
    </li>
  </ul>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["catagtory", "currentCatagtory"]),
  },
  created() {
    this.$store.dispatch("catagtory/getCatagtory");
  },
  methods: {
    changeIndex(id) {
      this.$store.commit("catagtory/updataCurrentCatagtory", id);
    },
  },
};
</script>

